//
//  CCYNewFeatureController.swift
//  03.微博
//
//  Created by 蔡承毅 on 16/9/24.
//  Copyright © 2016年 IOS. All rights reserved.
//

import UIKit

private let reuseIdentifier = "Cell"

class CCYNewFeatureController: UICollectionViewController {
    
    let layout = UICollectionViewFlowLayout()
    
    init(){
        super.init(collectionViewLayout:layout)
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    

    override func viewDidLoad() {
        super.viewDidLoad()
        
        self.collectionView?.register(CCYNewfeatureCell.self, forCellWithReuseIdentifier: reuseIdentifier)
        
        setupLayout()
    }
    
    private func setupLayout() {
        layout.itemSize = self.view.bounds.size
        layout.minimumLineSpacing = 0
        layout.minimumInteritemSpacing = 0
        layout.scrollDirection = UICollectionViewScrollDirection.horizontal
        
        collectionView?.bounces = false
        collectionView?.isPagingEnabled = true
        collectionView?.showsHorizontalScrollIndicator = false
    }


    override func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
        // #warning Incomplete implementation, return the number of items
        return NewFeatureCount
    }

    override func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
        let cell = collectionView.dequeueReusableCell(withReuseIdentifier: reuseIdentifier, for: indexPath) as! CCYNewfeatureCell
    
        // Configure the cell
        cell.indexpath = indexPath
    
        return cell
    }


}
